package org.seefly.iprint.service.impl;

import org.seefly.iprint.entity.DocPrice;
import org.seefly.iprint.mapper.PriceMapper;
import org.seefly.iprint.service.PriceService;
import org.seefly.iprint.vo.PriceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PriceServiceImpl implements PriceService {
   
    @Autowired
    private PriceMapper priceMapper;
    
    @Override
    public List<DocPrice> getDocPriceTable() {
        return priceMapper.getDocPriceTable();
    }
    
    @Override
    public void updatePrice(PriceVo vo) {
        priceMapper.updatePrice(vo);
    }
    
    @SuppressWarnings("rawtypes")
    @Override
    public List getPriceTable(String title) {
        List list = null;
        switch (title) {
            case "document" : list = priceMapper.getDocPriceTable();break;
            case "photo"    : list = priceMapper.getPhotoPriceTable();break;
            case "idphoto"  : list = priceMapper.geteIdPhotoPriceTable(); break;
            case "leaflet"  : list = priceMapper.getLeafletPriceTable();break;
        }
        return list;
    }
}
